<?php

class save_youhui_comment
{
public function index()
{
$root = array();
$email = addslashes($GLOBALS['request']['email']);
$pwd = addslashes($GLOBALS['request']['pwd']);
$user = user_check($email,$pwd);
$user_id  = intval($user['id']);
if ($user_id == 0){
$root['user_login_status'] = 0;
output($root);
}else{
$root['user_login_status'] = 1;
}
$yh_id = intval($GLOBALS['request']['yh_id']);
$content = addslashes($GLOBALS['request']['content']);
$merchant_youhui_comment = array(
'user_id'=>$user_id,
'rel_id'=>$yh_id,
'rel_table'=>'youhui',
'title'=>$content,
'content'=>$content,
'is_effect'=>1,
'create_time'=>get_gmtime(),
);
$GLOBALS['db']->autoExecute(DB_PREFIX.'message',$merchant_youhui_comment,'INSERT');
$id = $GLOBALS['db']->insert_id();
$root['id'] = $id;
if($id >0)
{
increase_user_active($user_id,'点评了一个优惠券');
$root['status'] = 1;
$root['info'] = '添加成功';
}else{
$root['status'] = 0;
$root['info'] = '添加失败';
}
output($root);
}
}

?>